#TOPDIR	:= $(shell /bin/pwd)
#CFLAGS= -Os -fomit-frame-pointer  -DVIDEO_DEBUG
INC_PATH =  -I/usr/include

#CFLAGS= -Os -fomit-frame-pointer 
CFLAGS=  
LDFLAGS= -L/usr/lib -L. -lpthread -lc -allow-shlib-undefined
CC = gcc
CPLUSPLUS = g++
LD = ld

#LDFLAGS += CERPATH

CFLAGS += -DDEBUG -D__Linux__ -g


ifeq ($(strip $(TOPDIR)),)
TOPDIR	:= $(shell /bin/pwd)/..
endif

ifeq ($(strip $(BUILD_MYAPP)), static)
CFLAGS += -DBUILD_STATIC
endif

ifeq ($(strip $(BUILD_MYAPP)), debug)
	CFLAGS += -g -static
else
#CFLAGS += -s
endif

all:per ui last

CFLAGS += $(INC_PATH) 	

CFLAGS += -I$(TOPDIR)/include
CFLAGS += -I$(TOPDIR)/com_inc

LDFLAGS += -L$(TOPDIR)/bin
LDFLAGS += -L$(TOPDIR)/lib

OBJ=ui.o 

per:
	cp *.h $(TOPDIR)/include 

last:
	cp ui $(TOPDIR)/bin 

ui:$(OBJ)
	$(CPLUSPLUS) $(OBJ)  -o ui $(LDFLAGS) -lframe

%.o: %.c
	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c -o $@ $<

%.o: %.cpp
	$(CPLUSPLUS) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c -o $@ $<


clean:
	-rm -f ui *.o
